package cn.tedu.knows.portal.mapper;

import cn.tedu.knows.portal.model.Answer;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author tedu.cn
 * @since 2021-11-26
 */
@Repository
public interface AnswerMapper extends BaseMapper<Answer> {
    //Mybatis提供的关联查询实现查询指定问题的所有回答和评论
    List<Answer> findAnswersByQuestionId(Integer questionId);

    @Update("update answer set accept_status=#{acceptStatus} where id=#{answerId}")
    int updateAcceptStatus(Integer acceptStatus, Integer answerId);
}
